package resource;

import jade.core.AID;

import java.io.Serializable;
import java.util.List;

import com.myprofile.profile.MuseumItem;
import com.myprofile.profile.ProfileType;

import daiia.ProfileManager;
import java.util.ArrayList;

public class Tour implements Serializable {
	public final static int T1 = 1;
	public final static int T2 = 2;
	public final static int T3 = 3;
	
	private int tourType;
	private List<TourItem> tourItems;
	public AID curator;
	
	public Tour(List<TourItem> tourItems, int tourType){
		this.tourType = tourType;
		this.tourItems = tourItems;
	}
	
	public void setTourType(int tourType){
		this.tourType = tourType;
	}
	
	public int getTourType(){
		return this.tourType;
	}
	
	public List<TourItem> getTourItems() {
		return tourItems;
	}

	public static Tour parseXMLProfile(String string) {
		ProfileManager pm = new ProfileManager();
		ProfileType profile = pm.loadProfile(string);
                
        List<MuseumItem> museumItems = profile.getVisitedItems().getVisitedItem();
        List<TourItem> tourItems = new ArrayList<TourItem>(15);
        for (MuseumItem item : museumItems){
            tourItems.add(new TourItem(item.getId(), item.getName(), item.getRating()));
        }
                
		
		return new Tour(tourItems, 0);
	}
	
	@Override
	public boolean equals(Object obj) {
		int type = (Integer)obj;
		System.out.println(type + " " + tourType + " BLABLABLA");
		return type == tourType;
	}
}
